package redora.rdo.test.rdo.service;

import java.util.Set;
import redora.rdo.api.BusinessRuleViolation;
import redora.rdo.exceptions.BusinessRuleViolationException;
import redora.rdo.test.rdo.service.base.JUnitChildBusinessRulesBase;
import redora.rdo.test.rdo.model.JUnitChild;
import redora.rdo.test.rdo.service.JUnitChildUtil;

public class JUnitChildBusinessRules extends JUnitChildBusinessRulesBase {
	public JUnitChildBusinessRules(JUnitChildUtil util) {
		super(util);
	}
	
	@Override
	public Set<BusinessRuleViolation> onInsert(JUnitChild pojo) throws BusinessRuleViolationException {
		Set<BusinessRuleViolation> retval = super.onInsert(pojo);
		
		return retval;
	}
	
	@Override
	public Set<BusinessRuleViolation> onUpdate(JUnitChild pojo) throws BusinessRuleViolationException {
		Set<BusinessRuleViolation> retval = super.onUpdate(pojo);
		
		//for example check if the updateDate is newer then the last updateDate
		//if (pojo.dirty.containsKey(JUnitChildFields.updateDate) {
		//  if (pojo.dirty.get(JUnitChildFields.updateDate) != null && pojo.dirty.get(JUnitChildFields.updateDate).compareTo(pojo.getUpdateDate() > 0) {
		//    retval.add(new BusinessRuleViolation(
		//		JUnitChild, JUnitChildFields.updateDate, BR_1, Action.Update));
		//  }
		//}
		return retval;
	}
	
	@Override
	public Set<BusinessRuleViolation> onDelete(JUnitChild pojo) throws BusinessRuleViolationException {
		Set<BusinessRuleViolation> retval = super.onDelete(pojo);
		
		return retval;
	}
}
